﻿using System;
using System.Linq;
using System.Net;
using SocialKit.LightRest;

namespace LightRestDemoSite
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var client = new RestClient("https://twitter.com/statuses/");
            client.TransportSettings.Credentials = 
                new NetworkCredential("your_twitter_id", "your_twitter_password");

            var response = client.Get("friends_timeline.xml");

            var xml = response.ReadContentAsXElement();

            var tweets = from tweet in xml.Elements("status")
                         select new
                         {
                             UserName = tweet.Element("user").Element("name").Value,
                             Tweet = tweet.Element("text").Value
                         };

            gvTweets.DataSource = tweets;
            gvTweets.DataBind();
        }
    }
}